package org.jivesoftware.spark.crowd;

import org.jivesoftware.resource.SparkRes;
import org.jivesoftware.spark.crowd.impl.Crowd;
import org.jivesoftware.spark.crowd.impl.Member;
import org.jivesoftware.spark.crowd.impl.TestCls;
import org.jivesoftware.spark.crowd.ui.CrowdItem;
import org.jivesoftware.spark.crowd.ui.CrowdList;
import org.jivesoftware.spark.plugin.Plugin;
import org.jivesoftware.spark.util.log.Log;

public class SparkCrowdsPlugin implements Plugin{

	@Override
	public boolean canShutDown() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void initialize() {
		try{
			CrowdsManager crowdsManager = CrowdsManager.getInstance();
			crowdsManager.init();
		
			crowdsManager.loadLocalCrowds();
			
			
			/**
			 * just for test
			 */
			
			
			/*Crowd test01 = new Crowd("justForTest",new Member("liyuan@127.0.0.1","李原"),"");
			//load crowd 
			crowdsManager.addCrowd(test01);
			
			
			CrowdItem test01Label = new CrowdItem("justForTest",SparkRes.getImageIcon(SparkRes.SMALL_ALL_CHATS_IMAGE));
			test01Label.initialize();
		
			CrowdList.getInstance().addCrowd(test01Label);
			TestCls tc = new TestCls();*/
//			tc.test();
		}catch(Exception e){
			Log.error("can't load local crowds!",e);
			
		}
	}

	@Override
	public void shutdown() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void uninstall() {
		// TODO Auto-generated method stub
		
	}

}
